<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>体育与健康课程管理系统</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/public/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/public/css/main.css"/>
    <link href="${pageContext.request.contextPath}/public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/public/js/libs/modernizr.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/public/js/jquery-3.2.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/public/js/layer/layer.js"></script>
    <script src="${pageContext.request.contextPath}/public/laydate/laydate.dev.js"></script>
</head>
<body>
<div class="container clearfix" style="width:100%">
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list" style="background:#fff; border:0px"><i class="icon-font"></i>修改体育知识考试安排</div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form  id="myform">
                    <table class="insert-tab" width="100%">
                        <tbody>
                        <tr>
                            <th><i class="require-red">*</i>选择考试周：</th>
                            <td>
                                <select name="systemExamWeeklyId"  style="height:32px" class="required">
                                    <option value="${data.systemExamWeeklyId }">${data.systemExamWeekly.systemExamWeeklyName }</option>
                                    <c:forEach items="${week }" var="y">
                                        <option value="${y.systemExamWeeklyId}">${y.systemExamWeeklyName }</option>
                                    </c:forEach>
                                </select>
                                </select>

                            </td>
                        </tr>
                            <tr>
                                <th><i class="require-red">*</i>考试名称：</th>
                                <td>
                                <input name='theoreticalExaminationId' style="display:none" type="text" value="${data.theoreticalExaminationId }" />
                                    <input class="common-text required" id="title" name="theoreticalExaminationName" size="85" value="${data.theoreticalExaminationName } " style="width:300px;height:32px" type="text">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>考试要求：</th>
                                <td><textarea name="theoreticalExaminationAsk" class="common-textarea" id="content"  style="width:300px" >${data.theoreticalExaminationAsk }</textarea></td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>考试地点：</th>
                                <td>
                                    <input class="common-text required" id="title" name="theoreticalExaminationPlace" size="85" value="${data.theoreticalExaminationPlace }" style="width:300px;height:32px" type="text">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>容纳人数：</th>
                                <td>
                                    <input class="common-text required" id="title" name="theoreticalExaminationPlaceNum" size="85" value="${data.theoreticalExaminationPlaceNum }" type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" style="width:300px;height:32px">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>开始时间：</th>
                                <td>
                            	<input class="common-text required" id="title" name="theoreticalExaminationStartTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${data.theoreticalExaminationStartTime}"  pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">           
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>结束时间：</th>
                                <td>
                            	<input class="common-text required" id="title" name="theoreticalExaminationEndTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${data.theoreticalExaminationEndTime}" pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">           
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>试卷模板ID：</th>
                                <td>
                                        <select name="theoreticalPaperModelId" id="catid" style="height:32px" class="required">
                                        	<option value="${data.theoreticalPaperModelId }">${data.theoreticalPaperModelId }</option>
									        <c:forEach items="${papermodel }" var="x">
									        <option value="${x.theoreticalPaperModelId}">试卷ID${x.theoreticalPaperModelId }</option>
									        </c:forEach>
                                        </select>

                                </td>
                            </tr>               
                           <tr>
                                <th><i class="require-red">*</i>考试类型：</th>
                                <td>
                                    <select name="theoreticalExaminationType" id="catid" style="height:32px" class="required">
                                      <option value="${data.theoreticalExaminationType}">${data.theoreticalExaminationType}</option>
							          <option value="正考">正考</option>
							          <option value="补考">补考</option>
                                	</select>
                                </td>
                            </tr>

                            <tr>
                                <th><i class="require-red">*</i>考试人数下限：</th>
                                <td>
                            <input class="common-text required" id="title" name="theoreticalExaminationLowerLimit" size="85" value="${data.theoreticalExaminationLowerLimit }" style="width:300px;height:32px" type="text">           
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>预约开始时间：</th>
                                <td>
                                    <input class="common-text required" id="title" name="orderStartTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${data.orderStartTime}"  pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>预约结束时间：</th>
                                <td>
                                    <input class="common-text required" id="title" name="orderEndTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${data.orderEndTime}" pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">
                                </td>
                            </tr>
                           <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" value="提交" type="button">
                                    <input class="btn btn6"  onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
</div>
</body>
<script type="text/javascript">
    $('.mr10').click(function(){
        var systemExamWeeklyId=$('select[name=systemExamWeeklyId]');
    	var theoreticalExaminationId=$('input[name=theoreticalExaminationId]');
        var theoreticalExaminationName=$('input[name=theoreticalExaminationName]');
    	var theoreticalExaminationAsk=$('textarea[name=theoreticalExaminationAsk]');
    	var theoreticalExaminationPlace=$('input[name=theoreticalExaminationPlace]');
    	var theoreticalExaminationPlaceNum=$('input[name=theoreticalExaminationPlaceNum]');
    	var theoreticalExaminationStartTime=$('input[name=theoreticalExaminationStartTime]');
    	var theoreticalExaminationEndTime=$('input[name=theoreticalExaminationEndTime]');
    	var theoreticalPaperModelId=$('select[name=theoreticalPaperModelId]');
    	var theoreticalExaminationType=$('select[name=theoreticalExaminationType]');
    	var theoreticalExaminationLowerLimit=$('input[name=theoreticalExaminationLowerLimit]');
        var orderStartTime=$('input[name=orderStartTime]');
        var orderEndTime=$('input[name=orderEndTime]');
        if(theoreticalExaminationName.val()=="")
        {
            layer.msg('考试名称不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
            theoreticalExaminationName.focus();
            return ;
        }
        if(theoreticalExaminationAsk.val()=="")
        {
            layer.msg('考试要求描述不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
            theoreticalExaminationAsk.focus();
            return ;
        }
        if(theoreticalExaminationPlace.val()=="")
        {
            layer.msg('考试地点不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
            theoreticalExaminationPlace.focus();
            return ;
        }
        if(theoreticalExaminationPlaceNum.val()=="")
        {
            layer.msg('容纳人数不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
            theoreticalExaminationPlaceNum.focus();
            return ;
        }
        
        if(theoreticalExaminationStartTime.val()=="")
        {
            layer.msg('开始时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
            theoreticalExaminationStartTime.focus();
            return ;
        }
        
        if(theoreticalExaminationEndTime.val()=="")
        {
            layer.msg('结束时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
            theoreticalExaminationEndTime.focus();
            return ;
        }

        if(theoreticalExaminationLowerLimit.val()=="")
        {
            layer.msg('考试人数下限不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
            theoreticalExaminationLowerLimit.focus();
            return ;
        }
        if(orderStartTime.val()=="")
        {
            layer.msg('预约开始时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            orderStartTime.focus();
            return ;
        }

        if(orderEndTime.val()=="")
        {
            layer.msg('预约结束时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            orderEndTime.focus();
            return ;
        }
        
		var StartTime = theoreticalExaminationStartTime.val().replace("/"," ");
		var EndTime	= theoreticalExaminationEndTime.val().replace("/"," ");
        var orderStartTime = orderStartTime.val().replace("/"," ");
        var orderEndTime = orderEndTime.val().replace("/"," ");
		
		$.post("${pageContext.request.contextPath}/knowledgetest/updatefun.action",{theoreticalExaminationId:theoreticalExaminationId.val(),theoreticalExaminationName:theoreticalExaminationName.val(),theoreticalExaminationAsk:theoreticalExaminationAsk.val(),
			theoreticalExaminationPlace:theoreticalExaminationPlace.val(),theoreticalExaminationPlaceNum:theoreticalExaminationPlaceNum.val(),theoreticalExaminationStartTime:StartTime,theoreticalExaminationEndTime:EndTime,theoreticalPaperModelId:theoreticalPaperModelId.val(),
			theoreticalExaminationType:theoreticalExaminationType.val(),theoreticalExaminationLowerLimit:theoreticalExaminationLowerLimit.val(),orderStartTime:orderStartTime,orderEndTime:orderEndTime,systemExamWeeklyId:systemExamWeeklyId.val()},function(returndata)
			{
	            if(returndata.code==1){
	                layer.msg(returndata.message, { offset: ['0px', '40%'], icon:6,time:1000},function(){
                        window.location.href="${pageContext.request.contextPath}/knowledgetest/selectweek.action?systemExamWeeklyId="+systemExamWeeklyId.val();
	                });
	              }
	            else
	            	layer.msg(returndata.message, { offset: ['0px', '40%'], icon:5,time:2000});
			});

    });
</script>
</html>